<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>MyPetStore</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link href="../../css/bootstrap.min.css" rel="stylesheet" />
    <link href="../../font-awesome/css/font-awesome.css" rel="stylesheet" />
    <link href="../../css/styleManage.css" rel="stylesheet" />

    <link href="../../css/plugins/iCheck/custom.css" rel="stylesheet"/>
    <link href="../../css/plugins/footable/footable.core.css" rel="stylesheet"/>
</head>
<body>
<div id="wrapper">
    <nav class="navbar-default navbar-static-side" role="navigation" th:include="/manage/nav :: navigation"></nav>
    <div id="page-wrapper" class="gray-bg">
        <div class="border-bottom" th:include="/manage/header :: headerTop"></div>
        <div class="row wrapper border-bottom white-bg page-heading" th:fragment="headerNav">
            <div class="col-lg-10">
                <h2>商品管理</h2>
                <ol class="breadcrumb">
                    <li>
                        <a th:href="@{/manage/viewCategory}">首页</a>
                    </li>
                    <li>
                        <a th:href="@{/manage/viewCategory}">大类管理</a>
                    </li>
                    <li>
                        <a th:href="@{/manage/viewProduct(categoryId=${session.category.categoryId})}">小类管理</a>
                    </li>
                    <li class="active">
                        <strong>商品管理</strong>
                    </li>
                </ol>
            </div>
            <div class="col-lg-2">
            </div>
        </div>

        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="row">
                <div class="col-lg-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5>搜索&amp;操作</h5>
                            <div class="ibox-tools">
                                <a class="collapse-link">
                                    <i class="fa fa-chevron-up"></i>
                                </a>
                            </div>
                        </div>
                        <div class="ibox-content" style="display: block;">
<!--                            <form action="itemManage_0_0_0">-->
<!--                                <div class="row">-->
<!--                                    <div class="col-sm-2 m-b-xs">-->
<!--                                        <input id="title" name="title" placeholder="商品标题" class="form-control" type="text" />-->
<!--                                    </div>-->
<!--                                    <div class="col-sm-2 m-b-xs">-->
<!--                                        <select name="cid" id="cid" class="form-control" >-->
<!--                                            <option value="0" >&#45;&#45;请选择商品分类&#45;&#45;</option>-->
<!--                                            <option >分类</option>-->
<!--                                        </select>-->
<!--                                    </div>-->

<!--                                    <div class="col-sm-2 m-b-xs">-->
<!--                                        <input id="minPrice" name="minPrice" class="form-control" type="text" placeholder="最低价格" />-->
<!--                                    </div>-->
<!--                                    <div class="col-sm-2 m-b-xs">-->
<!--                                        <input id="maxPrice" name="maxPrice"  class="form-control" type="text" placeholder="最高价格"/>-->
<!--                                    </div>-->
<!--                                    <div class="col-sm-2 m-b-xs">-->
<!--                                        <button class="btn btn-primary btn-block" type="submit"><i class="fa fa-search"></i>&nbsp;&nbsp;&nbsp;&nbsp;<strong>搜索</strong></button>-->
<!--                                    </div>-->
<!--                                    <div class="col-sm-2 m-b-xs">-->
<!--                                        <a th:href="@{'download1'}" class="btn btn-primary btn-block" >&nbsp;&nbsp;&nbsp;&nbsp;<strong>导出</strong></a>-->
<!--                                    </div>-->
<!--                                </div>-->
<!--                            </form>-->
                            <form action="/catalog/searchItem">
                                <div class="row">
                                    <div class="col-sm-2 m-b-xs">
                                        <input id="InputTable" name="keyword" placeholder="itemId" class="form-control" type="text" />
                                    </div>
                                    <div class="col-sm-2 m-b-xs">
                                        <button class="btn btn-primary btn-block" type="submit" name="search" value="Search"><i class="fa fa-search"></i>&nbsp;&nbsp;&nbsp;&nbsp;<strong>搜索</strong></button>
                                    </div>
                                </div>
                            </form>
                            <div class="row">
                                <div class="col-sm-6 m-b-xs">
                                    <a th:href="@{/manage/itemAdd(productId=${session.product.getProductId()})}" class="btn btn-primary btn-sm" data-toggle="tooltip" data-placement="left" title="" data-original-title="Refresh inbox"><i class="fa fa-plus"></i>&nbsp;&nbsp;&nbsp;&nbsp;新增商品&nbsp;&nbsp;&nbsp;&nbsp;</a>
                                </div>
                                <div class="col-sm-6 m-b-xs">
                                </div>
                            </div>

                        </div>
                    </div>
                </div>
                <div class="col-lg-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5>商品列表</h5>
                            <div class="ibox-tools">
                                <a class="collapse-link">
                                    <i class="fa fa-chevron-up"></i>
                                </a>
                            </div>
                        </div>
                        <div class="ibox-content">
                            <div class="table-responsive">
                                <table class=" table table-hover" data-page-size="10">
                                    <thead>
                                    <tr>
                                        <th width="10%">ID</th>
                                        <th width="10%">productID</th>
                                        <th width="10%">listprice</th>
                                        <th width="10%">unitcost</th>
                                        <th width="10%">supplier</th>
                                        <th width="10%">status</th>
                                        <th width="10%">attribute</th>
                                        <th width="10%">quantity</th>
                                        <th>操作</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr th:each="item : ${session.itemList}">
                                        <td th:text="${item.itemId}">Onions</td>
                                        <td th:text="${item.product.productId}">Onions</td>
                                        <td th:text="${item.listPrice}">Onions</td>
                                        <td th:text="${item.unitCost}">Onions</td>
                                        <td th:text="${item.supplierId}">Onions</td>
                                        <td th:text="${item.status}">Onions</td>
                                        <td th:text="${item.attribute1}">Onions</td>
                                        <td th:text="${item.quantity}">Onions</td>

                                        <td>
                                            <a th:href="@{'/manage/itemEdit?id='+${item.itemId}}" title="修改"><i class="fa fa-edit text-navy"></i></a>
                                        </td>

                                        <td><a th:href="@{'/manage/itemDelete?id='+${item.itemId}}" th:text="删除"></a>
<!--                                            th:onclick="'javascript:updateState('+${item.itemId}+',2,0);'"-->
                                        </td>
                                    </tr>
                                    </tbody>
                                    <tfoot>
                                    <tr>
                                        <td colspan="8">
                                            <ul id="pageHTML" class="pagination pull-right"></ul>
                                        </td>
                                    </tr>
                                    </tfoot>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="footer" th:include="/manage/footer :: copyright"></div>
    </div>
</div>

<!-- Mainly scripts -->
<script th:src="@{../../js/jquery-2.1.1.js}"></script>
<script th:src="@{../../js/bootstrap.min.js}"></script>
<script th:src="@{../../js/plugins/metisMenu/jquery.metisMenu.js}"></script>
<script th:src="@{../../js/plugins/slimscroll/jquery.slimscroll.min.js}"></script>

<!-- Peity -->
<script th:src="@{../../js/plugins/peity/jquery.peity.min.js}"></script>

<!-- Custom and plugin javascript -->
<script th:src="@{../../js/inspinia.js}"></script>
<script th:src="@{../../js/plugins/pace/pace.min.js}"></script>

<!-- iCheck -->
<script th:src="@{../../js/plugins/iCheck/icheck.min.js}"></script>

<!-- Peity -->
<script th:src="@{../../js/demo/peity-demo.js}"></script>

<!-- FooTable -->
<script th:src="@{../../js/plugins/footable/footable.all.min.js}"></script>

<!-- common -->
<script th:src="@{../../js/common.js}"></script>

<script th:inline="javascript">
    var pageHTML = [[${pageHTML}]];
    $(document).ready(function () {
        $("#pageHTML").html(pageHTML);
    });

    /*<![CDATA[*/
    function updateState(id,state,commendState){
        var deleteTag;
        if(state==2){
            deleteTag = confirm("确定删除此条信息?");
        } else {
            deleteTag = true;
        }
        if(deleteTag){
            $.ajax({
                type: "POST",
                url: "/manage/itemEditState?itemId="+id,
                contentType: "application/json; charset=utf-8",
                success: function(msg){
                    window.location.reload();
                },
                error: function(){
                    alert("系统异常！");
                }
            });
        }
    }
    /*]]>*/
</script>



</body>
</html>